package com.skt.domain.PO;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 租赁订单主表 - 持久化对象（PO）
 * <p>
 * 对应数据库表：rental_order
 */
@Data
@Accessors(chain = true)
@TableName("rental_order")
@Schema(description = "租赁订单持久化对象（PO）")
public class RentalOrder implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "主键ID", example = "1001")
    private Long id;

    @TableField("order_no")
    @Schema(description = "订单编号（如 R202509281234）", example = "R20251126123456")
    private String orderNo;

    @TableField("user_id")
    @Schema(description = "租用人ID", example = "2001")
    private Long userId;

    @TableField("merchant_id")
    @Schema(description = "所属商家ID", example = "3001")
    private Long merchantId;

    @TableField("start_date")
    @Schema(description = "租赁开始日期", example = "2025-12-01")
    private LocalDate startDate;

    @TableField("end_date")
    @Schema(description = "租赁结束日期", example = "2025-12-05")
    private LocalDate endDate;

    @TableField("total_days")
    @Schema(description = "租赁天数", example = "4")
    private Integer totalDays;

    @TableField("total_amount")
    @Schema(description = "总金额（租金）", example = "199.00")
    private BigDecimal totalAmount;

    @TableField("deposit_amount")
    @Schema(description = "押金金额", example = "100.00")
    private BigDecimal depositAmount;

    @TableField("paid_amount")
    @Schema(description = "已支付金额", example = "299.00")
    private BigDecimal paidAmount;

    @TableField("refund_amount")
    @Schema(description = "退款金额", example = "0.00")
    private BigDecimal refundAmount;

    @TableField("payment_status")
    @Schema(description = "支付状态：1-待支付，2-部分支付，3-已支付，4-已退款", example = "3")
    private Integer paymentStatus;

    @TableField("status")
    @Schema(description = "订单状态：1-待支付，2-已支付，3-已发货，4-已取货，5-已归还，6-已取消", example = "3")
    private Integer status;

    @TableField("remark")
    @Schema(description = "备注", example = "请尽快发货")
    private String remark;

    @TableField("ship_time")
    @Schema(description = "发货时间", example = "2025-11-27T10:00:00")
    private LocalDateTime shipTime;

    @TableField("returned_at")
    @Schema(description = "归还完成时间", example = "2025-12-06T15:30:00")
    private LocalDateTime returnedAt;

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-11-26T14:20:00")
    private LocalDateTime createdAt;

    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2025-11-26T14:25:00")
    private LocalDateTime updatedAt;
}